<%! func Index(w http.ResponseWriter,r *http.Request) error %>

<%% import "github.com/infinitbyte/framework/modules/ui/common" %%>
<%% import "net/http" %%>

<% common.Head(w, "Console","") %>

<link rel="stylesheet" href="/static/assets/uikit-2.27.1/css/components/notify.min.css" />
<script src="/static/assets/js/jquery.hotkeys-0.7.9.min.js"></script>
<script src="/static/assets/uikit-2.27.1/js/components/notify.min.js"></script>
<script src="/static/assets/js/page/console.js?v=1"></script>
<style type="text/css">
    pre{
        margin-top:0px;
        margin-bottom:0px;
        padding-top:4px;
        padding-bottom:4px;
    }
    .request pre{
        color:royalblue;
    }
    #log {
        max-height: 200px;
    }
    #logging {
        height: 500px;
        max-height: 1000px;
    }
</style>
<% common.Body(w) %>
<% common.Nav(w,r,"Console") %>



<div class="tm-middle">

    <div class="uk-container uk-container-center">

        <div class="uk-grid " data-uk-grid-margin>
            <div class="uk-width-1-1 ">

                <div class="uk-alert uk-alert-success" data-uk-alert="">
                    <a href="#" class="uk-alert-close uk-close"></a>
                    <p id="connect_status"></p>
                </div>

                <div id="log" class="uk-scrollable-text"></div>
                <form id="form" class="uk-form">
                    <input id="msg" type="text"  style="ime-mode: disabled" title="Press <s> to quick input; Type HELP for more details." placeholder="Press <s> to quick input; Type HELP for more details." autocomplete="on" class="uk-width-1-1">
                </form>
            </div>
            <div class="uk-width-1-1 ">

                <form class="uk-form" onsubmit="return false;">

                    <fieldset data-uk-margin>
                        <legend class="uk-text-primary">Realtime logging</legend>
                        <select id="log_level">
                            <option>ERROR</option>
                            <option>WARN</option>
                            <option selected>INFO</option>
                            <option>DEBUG</option>
                            <option>TRACE</option>
                        </select>
                        <input id="file_pattern" type="text" class="uk-form-width-medium" placeholder="FilePattern, eg: crawler*.go">
                        <input id="func_pattern" type="text" class="uk-form-width-medium" placeholder="FuncPattern, eg: runPipeline*">
                        <input id="message_pattern" type="text" class="uk-form-width-medium" placeholder="MessagePattern, eg: *timeout*">
                        <button class="uk-button uk-icon-play uk-button-success" onclick="updateLogging(true)"> START</button>
                        <button class="uk-button uk-icon-stop uk-button-danger" disabled onclick="updateLogging(false)"> STOP</button>
                        <div id="update_config_response"></div>
                    </fieldset>
                </form>


                <div id="logging" class="uk-scrollable-text "></div>
            </div>
        </div>

    </div>

</div>

<% common.Footer(w) %>
